package com.yishun.springboot.web;

import javax.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yinquan.util.ResultUtils;
import com.yishun.springboot.pojo.GwsElectroMasterdetailed;
import com.yishun.springboot.service.GongWuSuTimedUploadElectroService;

@RestController
@RequestMapping("cityEletro")
public class GwsElectroMasterdetailedController {

	@Resource
	GongWuSuTimedUploadElectroService gongWuSuTimedUploadElectroService;

	@RequestMapping("/uploadEletroDetailedData")
	public String uploadEletroDetailed(@RequestBody JSONObject jsonObject) {

		GwsElectroMasterdetailed electroMasterdetailed = JSONObject.toJavaObject(jsonObject,
				GwsElectroMasterdetailed.class);

		if (electroMasterdetailed == null) {
			return JSONObject.toJSONString(ResultUtils.jsonFail(400), SerializerFeature.WriteMapNullValue);
		}

		JSONObject res = gongWuSuTimedUploadElectroService.addGwsElectro(electroMasterdetailed);

		return JSONObject.toJSONString(res, SerializerFeature.WriteMapNullValue);
	}

}
